package com.wwwarehouse.contract.convert_to_pc;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextPaint;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;


import com.wwwarehouse.common.activity.base.BaseActivity;

import contract.wwwarehouse.com.contract.R;

/**
 * Created by feng.gao on 2017/9/1.
 * 这个页面成杰拿走了
 */

public class PcLoginPushActivity extends BaseActivity implements View.OnClickListener {

	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_pc_login_push);
		ImageView mCloseIv = (ImageView) findViewById(R.id.close_iv);
		ImageView mCenterIv = (ImageView) findViewById(R.id.center_iv);
		TextView mPushMsgTv = (TextView) findViewById(R.id.login_msg_tv);
		TextView mPushTipTv = (TextView) findViewById(R.id.tip_tv);
		Button mConfirmBtn = (Button) findViewById(R.id.module_gaofeng_confirm_btn);
		TextPaint paint = mPushMsgTv.getPaint();
		paint.setFakeBoldText(true);
		mCloseIv.setOnClickListener(this);
		if (getIntent() != null) {
			if (getIntent().getStringExtra("pc_login_result").equals("success")) {
				//登录成功
				mCenterIv.setImageDrawable(getResources().getDrawable(R.drawable.computer_ok));
				mPushMsgTv.setTextColor(getResources().getColor(R.color.common_color_c1_337cff));
				mPushMsgTv.setText("登录确认");
				mPushTipTv.setTextColor(getResources().getColor(R.color.common_color_c7_96999e));
				mPushTipTv.setText("为保障账户安全，请确认是本人操作");
				mConfirmBtn.setText("确认登录");

			} else if (getIntent().getStringExtra("pc_login_result").equals("fail")) {
				//登录失败
				mCenterIv.setImageDrawable(getResources().getDrawable(R.drawable.computer_error));
				mPushMsgTv.setTextColor(getResources().getColor(R.color.common_color_c2_f7a82f));
				mPushMsgTv.setText("连接超时，验证失败");
				mPushTipTv.setTextColor(getResources().getColor(R.color.common_color_c7_96999e));
				mPushTipTv.setText("请在PC端重新触发登录请求");
				mConfirmBtn.setText("我知道了");
			}
		}
	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.close_iv) {
			finish();
		} else if (getIntent() != null && getIntent().getStringExtra("pc_login_result").equals("success")) {
			// TODO: 2017/9/1 发送确认登录的接口
		} else if (getIntent() != null && getIntent().getStringExtra("pc_login_result").equals("fail")) {
			finish();
		}
	}
}
